package com.csu.mall.common;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;

public class Global {

    public static class WareConstant{
        @Getter
        @AllArgsConstructor
        public  enum OrderStatus{
            NEW_STATUS(0, "新建"),
            ALLOWCATED(1, "已分配"),
            PICKED(2, "已领取"),
            FINISHED(3, "已完成"),
            EXCEPTION(4, "有异常");
            int code;
            String msg;
        }

        @Getter
        @AllArgsConstructor
        public enum PurchasingItem{
            NEW_STATUS(0, "新建"),
            ALLOWCATED(1, "已分配"),
            PURCHASING(2, "正在采购"),
            FINISHED(3, "已完成"),
            EXCEPTION(4, "采购失败");
            int code;
            String msg;
        }
    }

    public static class ProductConstant{
        @Getter
        @AllArgsConstructor
        public  enum SpuStatus{
            NEW_STATUS(0L, "新建"),
            UP(1L, "上架"),
            DOWN(2L, "下架");
            Long code;
            String msg;
        }
    }


    /**
     * @Description: 错误状态码枚举
     * @Created: with IntelliJ IDEA.
     * @author: 夏沫止水
     * @createTime: 2020-05-27 17:29
     *
     * 错误码和错误信息定义类
     * 1. 错误码定义规则为5为数字
     * 2. 前两位表示业务场景，最后三位表示错误码。例如：100001。10:通用 001:系统未知异常
     * 3. 维护错误码后需要维护错误描述，将他们定义为枚举形式
     * 错误码列表：
     *  10: 通用
     *      001：参数格式校验
     *      002：短信验证码频率太高
     *  11: 商品
     *  12: 订单
     *  13: 购物车
     *  14: 物流
     *  15：用户
     *
     *
     *
     **/
    public enum BizCodeEnum {

        UNKNOW_EXCEPTION(10000,"系统未知异常"),
        VAILD_EXCEPTION(10001,"参数格式校验失败"),
        TO_MANY_REQUEST(10002,"请求流量过大，请稍后再试"),
        SMS_CODE_EXCEPTION(10002,"验证码获取频率太高，请稍后再试"),
        PRODUCT_UP_EXCEPTION(11000,"商品上架异常"),
        USER_EXIST_EXCEPTION(15001,"存在相同的用户"),
        PHONE_EXIST_EXCEPTION(15002,"存在相同的手机号"),
        NO_STOCK_EXCEPTION(21000,"商品库存不足"),
        LOGINACCT_PASSWORD_EXCEPTION(15003,"账号或密码错误");

        private Integer code;

        private String message;

        BizCodeEnum(Integer code, String message) {
            this.code = code;
            this.message = message;
        }

        public Integer getCode() {
            return code;
        }

        public String getMessage() {
            return message;
        }
    }
    public static class AuthServerConstant {
        public static final String SMS_CODE_CACHE_PREFIX = "sms:code:";
    }
}
